﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using Booking_System.User_Controls;
using Booking_System.ServiceReference1;

namespace Booking_System
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        public static InternalBookingServiceClient Service { get; internal set; }
        private UCLogin Login = new UCLogin();

        public MainWindow()
        {
            InitializeComponent();
            Service = new InternalBookingServiceClient();
            
            //LeftPane.Children.Clear();
            //LeftPane.Children.Add(new UCMenu2());
            AddElement(new UCManageBooking());
            //AddElement(new UCLogin());
            //AddElement(new UCGetPhone());
            //AddElement(ScreenUC1);
            //AddElement(new UCPhoneOverview());
            CreateHandlers();
        }

        private void CreateHandlers()
        {
            /*ScreenUC1.CreateSubscriptionClick += new RoutedEventHandler(UC1_CreateSubscriptionClick);
            AddHandler(Screen_1.CreateSubscriptionEvent, new RoutedEventHandler(UC1_CreateSubscriptionClick));*/
            Login.CreateLoginClick += new RoutedEventHandler(UCLogin_LoginClick);
            AddHandler(UCLogin.CreateLoginEvent, new RoutedEventHandler(UCLogin_LoginClick));
        }

        private void UCLogin_LoginClick(object sender, RoutedEventArgs e)
        {
            MessageBox.Show("This is a routed event using standard event args\r\n\r\n" +
                            "________________________________________________\r\n\r\n" +
                            "e.Source : " + sender.ToString() + "\r\n\r\n\r\n" +
                            "e.OriginalSource : " + e.OriginalSource.ToString());
            MessageBox.Show(Login.User + " - " + Login.Pass);
        }

        private void UC1_CreateSubscriptionClick(object sender, RoutedEventArgs e)
        {
            
            MessageBox.Show("This is a routed event using standard event args\r\n\r\n" +
                            "________________________________________________\r\n\r\n" +
                            "e.Source : " + sender.ToString() + "\r\n\r\n\r\n" +
                            "e.OriginalSource : " + e.OriginalSource.ToString());
        }




        private void AddElement(UIElement el)
        {
            RightPane.Children.Clear();
            RightPane.Children.Add(el);
        }

        private void ListBookings_Click(object sender, RoutedEventArgs e)
        {

        }

        private void CreateBooking_Click(object sender, RoutedEventArgs e)
        {
            
        }

    }
}
